-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change path max stack allocation to heap #10127
base: master
Are you sure you want to change the base?
Change path max stack allocation to heap #10127
Conversation
8cb5ec5
to
2149869
Compare
bbc428e
to
92fdb9a
Compare
92fdb9a
to
4920c1e
Compare
0dfae87
to
1bc0050
Compare
…er generating report
1bc0050
to
22cbe36
Compare
66bbe34
to
27e63b9
Compare
fuse_fd = fuse_open_channel(mountpoint, mountopts); | ||
if (fuse_fd < 0) { | ||
ret = fuse_fd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fuse_fd = fuse_open_channel(mountpoint, mountopts); | |
if (fuse_fd < 0) { | |
ret = fuse_fd; | |
ret = fuse_open_channel(mountpoint, mountopts); | |
if (ret< 0) { |
} | ||
|
||
/* Remove mount point directory */ | ||
vfs_log("removing directory '%s'", mountpoint); | ||
ret = rmdir(mountpoint); | ||
if (ret < 0) { | ||
vfs_error("failed to remove directory '%s': %m", mountpoint); | ||
return ret; | ||
goto out_free_mountpoint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need goto?
@@ -1778,6 +1795,11 @@ void ucs_config_parse_config_files() | |||
|
|||
/* Current working dir */ | |||
ucs_config_parse_config_file(".", UCX_CONFIG_FILE_NAME, 1); | |||
|
|||
out_free_path: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused label (pls check other places too)?
@@ -433,10 +433,10 @@ void ucs_memtrack_init() | |||
return; | |||
} | |||
|
|||
ucs_memtrack_vfs_init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that change related to this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I changed allocation at VFS to heap and it revealed this issue - an invalid count in the memtrack (tests were failing)
|
||
/* Build parent nodes along the rel_path, without associated object */ | ||
next_token = rel_path_buf; | ||
token = strsep(&next_token, "/"); | ||
while (next_token != NULL) { | ||
current_node = ucs_vfs_node_add_subdir(current_node, token); | ||
if (current_node == NULL) { | ||
return UCS_ERR_NO_MEMORY; | ||
status = UCS_ERR_NO_MEMORY; | ||
goto out_free_abs_path_buf; | ||
} | ||
|
||
token = strsep(&next_token, "/"); | ||
} | ||
|
||
ucs_vfs_node_build_path(current_node, token, abs_path_buf, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ucs_vfs_node_build_path(current_node, token, abs_path_buf, | |
ucs_vfs_node_build_path(current_node, token, abs_path_buf, PATH_MAX); |
ret = mkdir(dirname(sock_path_dir), S_IRWXU); | ||
if ((ret < 0) && (errno != EEXIST)) { | ||
ucs_log(log_level, "failed to create directory '%s': %m", | ||
sock_path_dir); | ||
return -errno; | ||
ret = -errno; | ||
goto out_free_sock_path_dir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need goto?
What?
This PR changes all stack allocations of char arrays sized
PATH_MAX
to heap allocations.Why?
Customers with limited stack sizes have recently experienced stack overflow issues when running UCX. Moving these allocations to the heap prevents such overflows.
How?
Heap allocations replace stack allocations for char arrays of size
PATH_MAX
.